a = list('123')
b = list('123')

print('a if is equals to b ?', a == b)
print('a if is exactly to b ?', a is b)

print("how about it when both a and b is str class ?")

a = '123'
b = '123'

print('a if is equals to b ?', a == b)  # has the same elements.
print('a if is exactly to b ?', a is b)  # is the same object.

a = [1, 2, 3, 4, 5]
b = a[:]
# false, The braket operator creates(get slice) a new list, but append does not.
print('a is b?', a is b)

a = '123'
b = a[:]
# But str is immutable, so a is the same object as b refer to .
print('a is b ?', a is b)

# str, join and list, split
print('--------------------list.split, str.join--------------------')
l = ['yin', 'chao']
delimiter = '-'
s = delimiter.join(l)
print(s)
print(s.split('-'))

# remove, pop, del
print('--------------------remove, pop, del------------------------')
l.remove('chao')
print(l)
print(l.pop(0))
print(l)
l.append('x')
del l[0]
print(l)

# traversing a list
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for n in l:
    print(n)

for i in range(len(l)):
    print(i, l[i] * 2)
